#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
int main(){
    freopen("duel.in", "r", stdin);
    freopen("duel.out", "w", stdout);
    int n;
    int a[MAXN];
    cin >> n;
    bool k = 1;
    int sumn = 0, sumx = 0;
    int mn = 1e5;
    int mx = 0;
    for(int i = 0;i < n;i++){
        cin >> a[i];
        mn = min(mn, a[i]);
        mx = max(mx, a[i]);
    }
    for(int i = 0;i < n;i++){
        if(a[i] == mn) sumn++;
        if(a[i] == mx) sumx++;
    }
    cout << max(sumn, sumx) << endl;
    return 0;
}
